<template>
	<view>
		<button type="primary" @click="setStrorage">存储数据</button>
		<button type="primary" @click="setStrorage">获取数据</button>
		<button type="primary" @click="removeId">移除id</button>
		
		<!-- #ifdef H5 -->
		<view>我希望只在h5页面中</view>
		<!-- #endif -->
		<view>我希望值在微信小程序页面中看见</view>
		<!-- #ifdef HP-WEIXIN -->
		<view>我只希望在APP页面中看见</view>
		
		<view>这是列表页</view>
		<view class="box-item" v-if="item in les">{{item}}</view>
		
		<button @click="pullDown">下拉刷新</button>
		<view>这是列表页</view>
		<view class="box-item" v-for="item in list">{{item}}</view>
		
		<image v-for="item in imgArr" :src="item" @click="uni.previewImage({item})"></image>
		
	</view>
</template>

<script>
	export default {
		data(){
			return: {
				list:['前端','JAVA','UI','测试','大数据'],
				imgArr: []
			}
		},
		methods: {
			puliDown(){
				console.log('开启下拉刷新')
				uni.startPullDownRefresh()
			},
			previewImage (current){
				uni.previewImage({
					current,
					urls: this.imgArr,
					loop: true
				})
			},
			chooseImg () {
				uni.chooseImage({
					count: 5,
					success: res=>{
						this.imgArr=res.tempFilePaths
					}
				})
			
			},
			sertStorage () {
				
			},
			
			uni.setStorageSync('id',100)
		},

		getStorage(){
			const res = uni.getStroageSync('id')
			console.log(res)
		},
		
		onload(options){
			console.log('页面加载了')
		},
		
		onPullDownRefresh() {
			console.log('触发了下拉刷新')
			setTimeout(()=>{
				this.list = ['前端','JAVA','UI','测试','大数据'];
				uni.setopPullDownRefresh()
			},2000)
		},
		onReachBottom() {
			console.log('页面触底了'),
			this.list = [...this,list,...['前端','JAVA','UI','测试','大数据']];
		}
		
		onShow(){
			console.log('页面显示了')
		},
		onReady(){
			console.log('页面初次渲染完成le')
		},
		onHide(){
			console.log('页面隐藏了')
		},
		onLoad() {
			//#// #ifdef APP
			console.log('我希望h5中打印')
			// #endif
			console.log('我希望微信小程序中打印')
		}
	}
	
</script>

<style>
	.bok-item{
		height: 100px;
		line-height: 100px;
	}
	/* h5中的样式 */
	view{
		color: hotpink;
	}
	
	view{
		color: #0000FF;
	}
</style>